#ifndef __H_GPIOI2C
#define __H_GPIOI2C
#include "s3c2440_gpio.h"
#include "delay.h"
#define GPIO_IICSDA BLANK_GPH,4
#define GPIO_IICSCL BLANK_GPH,5
#define IICSDA_sw() gpio_ioctl(GPIO_IICSDA,TYPE_OUT)
#define IICSDA_sr() gpio_ioctl(GPIO_IICSDA,TYPE_IN)
#define IICSCL_sw() gpio_ioctl(GPIO_IICSCL,TYPE_OUT)
#define IICSCL_sr() gpio_ioctl(GPIO_IICSCL,TYPE_IN)

#define IICSDA_w(x) gpio_write(GPIO_IICSDA,x)
#define IICSCL_w(x) gpio_write(GPIO_IICSCL,x)

#define IICSDA_r() (gpio_read(GPIO_IICSDA))
#define IICSCL_r() (gpio_read(GPIO_IICSCL))

#define IICDELAY() (delay(1*100))
#define IICDELAY2(x) (delay(x/10))
void i2c_start();
void i2c_stop();
unsigned char i2c_write (unsigned char addr, unsigned char* buf, int len);
unsigned char i2c_read(unsigned char addr, unsigned char* buf, int len);
unsigned char i2c_write_byte(unsigned char b);
unsigned char i2c_read_byte();
unsigned char i2c_writereg(unsigned deviceAddr,unsigned char regaddr, unsigned char value);
unsigned char i2c_readreg(unsigned deviceAddr,unsigned char regaddr, unsigned char *value);
unsigned char InitFunc();
void ExitFunc();
#endif